package pers.kui.mall.controller;

import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import pers.kui.mall.common.ApiRestResponse;
import pers.kui.mall.service.OrderService;

/**
 * @author: ldk
 * 描述: 后台订单管理Controller
 */
@RestController
@RequestMapping("/admin/order")
public class OrderAdminController {

    @Autowired
    OrderService orderService;

    @GetMapping("/list")
    @ApiOperation("管理员订单列表")
    public ApiRestResponse listForAdmin(@RequestParam Integer pageNum, @RequestParam Integer pageSize) {
        PageInfo pageInfo = orderService.listForAdmin(pageNum, pageSize);
        return ApiRestResponse.success(pageInfo);
    }

    //发货，订单流程：0用户已取消，10未付款，20已付款，30已发货，40交易已完成
    @PostMapping("/delivered")
    @ApiOperation("管理员发货")
    public ApiRestResponse listForAdmin(@RequestParam String orderNo) {
        orderService.deliver(orderNo);
        return ApiRestResponse.success();
    }




}
